#!/usr/bin/env bash

requirements_find_gentoo_paludis()
{
  if
    eselect package-manager >/dev/null 2>&1
  then
    [[ $(eselect package-manager show | __rvm_tail -1 | __rvm_sed 's/ //g') = 'paludis' ]] || return $?
  else
    __rvm_which cave >/dev/null 2>&1 || return $?
  fi
}

requirements_gentoo_paludis_lib_installed()
{
  cave show "$1" | __rvm_grep "::installed" >/dev/null || return $?
}

requirements_gentoo_paludis_libs_install()
{
  __rvm_try_sudo cave resolve -x "$@" || return $?
}

requirements_gentoo_paludis_update_system()
{
  __rvm_try_sudo cave sync || return $?
}
